package com.edu.controller;

import com.edu.commons.R;
import com.edu.service.ProductService;
import com.edu.vo.ProductVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @ProjectName: myApp
 * @Titile: ProductController
 * @Author: Administrator
 * @Description: 商品控制层
 */
@RestController
@RequestMapping("/api/product") //一级路径
public class ProductController {
    @Autowired
    private ProductService productService;

    /**
     * 查询商品列表的服务接口
     * @return 商品列表
     */
    @GetMapping("list")
    public R<List<ProductVO>> getProductList(){
        List<ProductVO> productList = productService.getProductList();
        return R.ok("商品查询成功", productList);
    }

}
